/*
 * CalendarChangedEvent.java
 *
 * Created on 7-Mar-2010.
 */

package org.calendar.event;

import java.util.EventObject;
import java.util.Calendar;

/**
 * This class holds information related to a selected
 * calendar change in  JCalendar.
 *
 * @see org.calendar.event.CalendarListener
 * @see org.calendar.JDaySelector
 * @see org.calendar.JMonthNavigator
 *
 * @author Julie Duvillier
 */

public class CalendarChangedEvent extends EventObject {

    /* selected calendar */
    Calendar selectedCalendar =null;


    /**
     * Create a new CalendarChangedEvent.
     * @param source  the object on which the event occurred.
     * @param calendar the selected calendar
     */
    public  CalendarChangedEvent ( Object source, Calendar calendar){
        super(source);
        this.selectedCalendar = calendar;
    }
    
    /**
     * Gets the selected calendar
     * @return the selected calendar
     */
    public Calendar getSelectedCalendar() {
	return selectedCalendar;
    }

    /**
     * Returns a String representation of this CalendarChangedEvent
     * @return a String representation of this  CalendarChangedEvent.
     */
    @Override
    public String toString(){
        String str = super.toString();
        if( selectedCalendar != null){
            str= str + "the selected calendar: " + selectedCalendar.getTime();
        }
        return str;
    }
}
